package com.seagull.sb.bo.impl;

import java.util.Collections;
import java.util.List;

import com.seagull.sb.bo.LeaveBO;
import com.seagull.sb.dao.LeaveDAO;
import com.seagull.sb.domain.Leave;
import com.seagull.sb.dto.LeaveDto;
import com.seagull.sb.util.SBRequestContext;

public class LeaveBOImpl extends BaseBOImpl implements LeaveBO{
	private LeaveDAO leaveDAO;
	
	public List<Leave> getLeaves(SBRequestContext rc, LeaveDto leaveDto){
		Object result;
		try{
			
			 return leaveDAO.getLeaves(rc);
		}catch(Exception e){
			e.printStackTrace();
		}
		return Collections.EMPTY_LIST;
	}

	public List<Leave> send(SBRequestContext rc, Leave leave) {
		
		try {
			boolean leaveSaved = leaveDAO.create(rc,leave);
			/*if(leaveSaved && leave.getId() > 0){
				leaveDAO.saveNoticeAudit(rc, leave); 
			}*/
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return Collections.EMPTY_LIST;
	}
	
	public boolean authorize(SBRequestContext rc, Leave leave) {
		
		boolean leaveSaved = false;
		try {
			leaveSaved = leaveDAO.update(rc,leave);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return leaveSaved;
	}
		
	public LeaveDAO getLeaveDAO() {
		return leaveDAO;
	}
	public void setLeaveDAO(LeaveDAO leaveDAO) {
		this.leaveDAO = leaveDAO;
	}
}
